/**
 * Created by zyl on 16/12/12.
 */

//************获取图标实例******************
var line_chart_player_retention = echarts.init($('#line-chart-player-retention')[0]); // 用户留存率走势概况

//************用户留存率趋势概况******************
function get_retention(instance, data) {
    option = {
        title: {
            text: '留存趋势概况'
        },
        tooltip: {
            trigger: 'axis'
        },
        legend: {
            data: ['留存率']
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        toolbox: {
            feature: {
                saveAsImage: {}
            },
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: ['当天', '1天后', '2天后', '3天后', '4天后', '5天后', '6天后', '7天后', '14天后', '30天后']
        },
        yAxis: {
            type: 'value',
            min: 0,
            max: 100,
            axisLabel: {
                show: true,
                interval: 'auto',
                formatter: '{value} %'
            }
        },
        series: [
            {
                name: '留存率',
                type: 'line',
                stack: '总量',
                data: data
            }
        ],
        color: ['#00ffaa']
    };
    instance.setOption(option);
}

window.onresize = function () {
    $("#line-chart-player-retention").width($(".dashboard-widget").width() - 50);
    line_chart_player_retention.resize();
};


